<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>全局注册</title>
    <script src="./js/vue.js"></script>
</head>
<style>
    .color{
        color: gold;
    }
</style>
<body>
<div id="app">
    <model1></model1>
</div>
<div id="app2">
    <model1></model1>
</div>
<script>
    Vue.component("model1",{
        template: "<div>" +
            "<p :class='color'>{{title}}</p>" +
            "<button @click='alter()'>点我</button>" +
            "</div>",
        data:function (){
            return {
                title : "全局注册",
                color: "color"
            }
        },
        methods:{
            alter:function () {
                alert("全局注册")
            }
        }
    });

    new Vue({
        el: "#app",
        data: {}
    });
    new Vue({
        el: "#app2",
        data: {}
    });
</script>
</body>
</html>